<?php

namespace App\Model\System;


use Illuminate\Database\Eloquent\Model;


class Token extends Model
{
    public $table = 'xuser_token';
    public $primaryKey = 'id';
    const USERSALT = 'aksfnowiuasfkqwen1sfe2d';

    protected $fillable = [
        'xuserid',
        'token',
    ];

    static function user()
    {
        $token = app('session')->get('token');
        $userid = Token::where('token',$token)->pluck('xuserid')->first();
        $user = User::find($userid);
        return $user;
    }

}



